/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package oplm;

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.Serializable;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
import javax.xml.bind.annotation.XmlRootElement;
import org.eclipse.persistence.annotations.Transformation;

/**
 *
 * @author hh
 */
@Entity
@Table(name = "REPORT")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Report.findAll", query = "SELECT r FROM Report r"),
    @NamedQuery(name = "Report.findById", query = "SELECT r FROM Report r WHERE r.id = :id"),
    @NamedQuery(name = "Report.findByPeopleId", query = "SELECT r FROM Report r WHERE r.peopleId = :peopleId"),
    @NamedQuery(name = "Report.findByTitle", query = "SELECT r FROM Report r WHERE r.title = :title"),
    @NamedQuery(name = "Report.findByContent", query = "SELECT r FROM Report r WHERE r.content = :content"),
    @NamedQuery(name = "Report.findByAddDate", query = "SELECT r FROM Report r WHERE r.addDate = :addDate"),
    @NamedQuery(name = "Report.findByReportDate", query = "SELECT r FROM Report r WHERE r.reportDate = :reportDate")})
public class Report implements Serializable {
   
    
    @Transient
       private List<PropertyChangeListener> propertyChangeListeners = new LinkedList<PropertyChangeListener>();
 
    
       public void addPropertyChangeListener(PropertyChangeListener l) {
        propertyChangeListeners.add(l);
    }
    public void removePropertyChangeListener(PropertyChangeListener l) {
        propertyChangeListeners.remove(l);
    }
    protected void firePropertyChange(String name, Object oldValue, Object newValue) {
        PropertyChangeEvent evt = new PropertyChangeEvent(this, name, oldValue, newValue);
        for (int i = 0;i<propertyChangeListeners.size();i++) {
            propertyChangeListeners.get(i).propertyChange(evt);
        }
    }
    
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @GeneratedValue
    @Column(name = "ID")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "PEOPLE_ID")
    private int peopleId;
    @Column(name = "TITLE")
    private String title;
    @Column(name = "CONTENT")
    private String content;
    @Column(name = "ADD_DATE")
    @Temporal(TemporalType.DATE)
    private Date addDate;
    @Column(name = "REPORT_DATE")
    @Temporal(TemporalType.DATE)
    private Date reportDate;

    public Report() {
    }

    public Report(Integer id) {
        this.id = id;
    }

    public Report(Integer id, int peopleId) {
        this.id = id;
        this.peopleId = peopleId;
      
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
        firePropertyChange("id", id, this.id);
    }

    public int getPeopleId() {
        return peopleId;
    }

    public void setPeopleId(int peopleId) {
        this.peopleId = peopleId;
        firePropertyChange("peopleId", peopleId, this.peopleId);
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
        firePropertyChange("title", title, this.title);
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
        firePropertyChange("content", content, this.content);
    }

    public Date getAddDate() {
        return addDate;
    }

    public void setAddDate(Date addDate) {
        this.addDate = addDate;
        firePropertyChange("addDate", addDate, this.addDate);
    }

    public Date getReportDate() {
        return reportDate;
    }

    public void setReportDate(Date reportDate) {
        this.reportDate = reportDate;
        firePropertyChange("reportDate", reportDate, this.reportDate);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Report)) {
            return false;
        }
        Report other = (Report) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "oplm.Report[ id=" + id + " ]";
    }
    
}
